home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Gekkan Dennou Club 147
/
Gekkan Dennou Club - 2000.8 Vol. 147 (Japan).7z
/
Gekkan Dennou Club - 2000.8 Vol. 147 (Japan) (Track 1).bin
/
tools
/
ws
/
wst.c
< prev
next >
Wrap
C/C++ Source or Header
|
2000-05-05
|
28KB
|
541 lines
#include <stdio.h>
#include <stdlib.h>
int namebt(int data);
void main(int argc, char *argv[])
{
FILE *fp1,*fp2;
int d,i,j,m,datai;
char datac;
char sa,sb;
printf("wst.x ver. 0.01 1999,2000 Takeo Koba\n\n");
if((fp1=fopen(argv[1],"rb"))==NULL){ /* ファイルオープン */
printf("\n wst.x [TEAM DATA FILE] <[SAVE DATA TEXT]>\n");
exit(1);
}
if((fp2=fopen(argv[2],"wt"))==NULL){ /* ファイルオープン */
if((fp2=fopen("WS_TEAM.txt","wt"))==NULL){ /* ファイルオープン */
printf("\n savefile open error! \n");
exit(1);
}
}
for(j = 0;j < 12;j++){
switch(j){
case 0:fprintf(fp2,"\nGチーム\n\n");break;
case 1:fprintf(fp2,"\nCチーム\n\n");break;
case 2:fprintf(fp2,"\nDチーム\n\n");break;
case 3:fprintf(fp2,"\nSチーム\n\n");break;
case 4:fprintf(fp2,"\nWチーム\n\n");break;
case 5:fprintf(fp2,"\nTチーム\n\n");break;
case 6:fprintf(fp2,"\nLチーム\n\n");break;
case 7:fprintf(fp2,"\nBチーム\n\n");break;
case 8:fprintf(fp2,"\nHチーム\n\n");break;
case 9:fprintf(fp2,"\nFチーム\n\n");break;
case 10:fprintf(fp2,"\nOチーム\n\n");break;
case 11:fprintf(fp2,"\nBuチーム\n\n");break;
}
printf("%dチーム目・・・\n",j+1);
for(m = 0;m < 0x08;m++){
for(i = 0;i < 0x13;i++){
if(i == 0){
datai=fgetc(fp1);
fprintf(fp2,"%d. ",datai+1);
}
if((i > 0)&&(i < 7)){
datai=fgetc(fp1);
d = namebt(datai);
sa = d / 0x100;sb = d % 0x100;
fprintf(fp2,"%c%c",sa,sb);
}
if(i == 7){
datai=fgetc(fp1);
if(datai<10) fprintf(fp2," %d ",datai);
else fprintf(fp2," %d ",datai);
}
if(i == 8){
datai=fgetc(fp1);
if((datai%2) == 0) fprintf(fp2,"R ");
else if((datai%2) == 1) fprintf(fp2,"L ");
else fprintf(fp2,"? ");
}
if(i == 9){
datai=fgetc(fp1);
fprintf(fp2,"%d ",(datai>>4)%4);
fprintf(fp2,"%d ",(datai>>2)%4);
if(datai%2) fprintf(fp2,"黒 ");
else fprintf(fp2,"木 ");
}
if(i == 0x0a){
datai=fgetc(fp1);
switch(datai){
case 1:fprintf(fp2,"P ");break;
case 2:fprintf(fp2,"C ");break;
case 3:fprintf(fp2,"1B");break;
case 4:fprintf(fp2,"2B");break;
case 5:fprintf(fp2,"3B");break;
case 6:fprintf(fp2,"SS");break;
case 7:fprintf(fp2,"LF");break;
case 8:fprintf(fp2,"CF");break;
case 9:fprintf(fp2,"RF");break;
default:fprintf(fp2,"- ");break;
}
}
if(i == 0x0b){
datai=fgetc(fp1);
fprintf(fp2," .%d ",datai+150);
}
if(i == 0x0c){
datai=fgetc(fp1);
if(datai<10) fprintf(fp2," %d ",datai);
else fprintf(fp2,"%d ",datai);
}
if(i == 0x0d) datai=fgetc(fp1);
if(i == 0x0e){
datai=fgetc(fp1);
if(datai) fprintf(fp2," ON ");
else fprintf(fp2," OFF");
}
if(i == 0x0f){
datai=fgetc(fp1);
if(datai<10) fprintf(fp2," %d ",datai);
else fprintf(fp2," %d ",datai);
}
if(i == 0x10){
datai=fgetc(fp1);
if(datai<10) fprintf(fp2," %d - ",datai);
else if(datai==100) fprintf(fp2,"%d - ",datai);
else fprintf(fp2," %d - ",datai);
}
if(i == 0x11){
datai=fgetc(fp1);
if(datai<10) fprintf(fp2," %d ",datai);
else if(datai==100) fprintf(fp2,"%d ",datai);
else fprintf(fp2," %d ",datai);
}
if(i == 0x12){
datai=fgetc(fp1);
if(datai<20) fprintf(fp2," %d\n",datai/2);
else if(datai==200) fprintf(fp2,"%d\n",datai/2);
else fprintf(fp2," %d\n",datai/2);
}
}
for(i = 0;i < 13;i++) datai=fgetc(fp1);
}
printf("スタメン野手終了/");
fprintf(fp2,"\n");
for(m = 0x08;m < 0x0d;m++){
for(i = 0;i < 0x13;i++){
if(i == 0){
datai=fgetc(fp1);
fprintf(fp2,"PH ");
}
if((i > 0)&&(i < 7)){
datai=fgetc(fp1);
d = namebt(datai);
sa = d / 0x100;sb = d % 0x100;
fprintf(fp2,"%c%c",sa,sb);
}
if(i == 7){
datai=fgetc(fp1);
if(datai<10) fprintf(fp2," %d ",datai);
else fprintf(fp2," %d ",datai);
}
if(i == 8){
datai=fgetc(fp1);
if((datai%2) == 0) fprintf(fp2,"R ");
else if((datai%2) == 1) fprintf(fp2,"L ");
else fprintf(fp2,"? ");
}
if(i == 9){
datai=fgetc(fp1);
fprintf(fp2,"%d ",(datai>>4)%4);
fprintf(fp2,"%d ",(datai>>2)%4);
if(datai%2) fprintf(fp2,"黒 ");
else fprintf(fp2,"木 ");
}
if(i == 0x0a){
datai=fgetc(fp1);
switch(datai){
case 1:fprintf(fp2,"P ");break;
case 2:fprintf(fp2,"C ");break;
case 3:fprintf(fp2,"IF");break;
case 4:fprintf(fp2,"IF");break;
case 5:fprintf(fp2,"IF");break;
case 6:fprintf(fp2,"IF");break;
case 7:fprintf(fp2,"OF");break;
case 8:fprintf(fp2,"OF");break;
case 9:fprintf(fp2,"OF");break;
default:fprintf(fp2,"- ");break;
}
}
if(i == 0x0b){
datai=fgetc(fp1);
fprintf(fp2," .%d ",datai+150);
}
if(i == 0x0c){
datai=fgetc(fp1);
if(datai<10) fprintf(fp2," %d ",datai);
else fprintf(fp2,"%d ",datai);
}
if(i == 0x0d) datai=fgetc(fp1);
if(i == 0x0e){
datai=fgetc(fp1);
if(datai) fprintf(fp2," ON ");
else fprintf(fp2," OFF");
}
if(i == 0x0f){
datai=fgetc(fp1);
if(datai<10) fprintf(fp2," %d ",datai);
else fprintf(fp2," %d ",datai);
}
if(i == 0x10){
datai=fgetc(fp1);
if(datai<10) fprintf(fp2," %d - ",datai);
else if(datai==100) fprintf(fp2,"%d - ",datai);
else fprintf(fp2," %d - ",datai);
}
if(i == 0x11){
datai=fgetc(fp1);
if(datai<10) fprintf(fp2," %d ",datai);
else if(datai==100) fprintf(fp2,"%d ",datai);
else fprintf(fp2," %d ",datai);
}
if(i == 0x12){
datai=fgetc(fp1);
if(datai<20) fprintf(fp2," %d\n",datai/2);
else if(datai==200) fprintf(fp2,"%d\n",datai/2);
else fprintf(fp2," %d\n",datai/2);
}
}
for(i = 0;i < 13;i++) datai=fgetc(fp1);
}
printf("控え野手終了/");
fprintf(fp2,"\n");
for(m = 0x0d;m < 0x12;m++){
for(i = 0;i < 0x17;i++){
if(i == 0){
datai=fgetc(fp1);
if((datai==0x10)||(datai==0x11)) fprintf(fp2,"R. ");
else fprintf(fp2,"S. ");
}
if((i > 0)&&(i < 7)){
datai=fgetc(fp1);
d = namebt(datai);
sa = d / 0x100;sb = d % 0x100;
fprintf(fp2,"%c%c",sa,sb);
}
if(i == 7){
datai=fgetc(fp1);
if(datai<10) fprintf(fp2," %d ",datai);
else fprintf(fp2," %d ",datai);
}
if(i == 8){
datai=fgetc(fp1);
if((datai%8) == 0) fprintf(fp2,"RO");
else if((datai%8) == 1) fprintf(fp2,"LO");
else if((datai%8) == 4) fprintf(fp2,"RU");
else if((datai%8) == 5) fprintf(fp2,"LU");
else fprintf(fp2,"? ");
}
if(i == 9){
datai=fgetc(fp1);
fprintf(fp2," %d ",(datai>>4)%4);
fprintf(fp2,"%d ",(datai>>2)%4);
if(datai%2) fprintf(fp2,"黒 ");
else fprintf(fp2,"木 ");
}
if(i == 0x0a){
datai=fgetc(fp1);
switch(datai){
case 1:fprintf(fp2,"P ");break;
case 2:fprintf(fp2,"C ");break;
case 3:fprintf(fp2,"IF");break;
case 4:fprintf(fp2,"IF");break;
case 5:fprintf(fp2,"IF");break;
case 6:fprintf(fp2,"IF");break;
case 7:fprintf(fp2,"OF");break;
case 8:fprintf(fp2,"OF");break;
case 9:fprintf(fp2,"OF");break;
default:fprintf(fp2,"- ");break;
}
}
if(i == 0x0b){
datai=fgetc(fp1);
if(datai%50<10)fprintf(fp2," %d.0%d ",datai/50,datai%50);
else fprintf(fp2," %d.%d ",datai/50,datai%50);
}
if(i == 0x0c){
datai=fgetc(fp1);
if(datai<10) fprintf(fp2," %d ",datai);
else fprintf(fp2,"%d ",datai);
}
if(i == 0x0d) datai=fgetc(fp1);
if(i == 0x0e){
datai=fgetc(fp1);
if(datai) fprintf(fp2," ON ");
else fprintf(fp2," OFF");
}
if(i == 0x0f){
datai=fgetc(fp1);
if(datai<10) fprintf(fp2," %d ",datai);
else fprintf(fp2," %d ",datai);
}
if(i == 0x10){
datai=fgetc(fp1);
if(datai<10) fprintf(fp2," %d / ",datai);
else if(datai<100) fprintf(fp2," %d / ",datai);
else fprintf(fp2,"%d / ",datai);
}
if(i == 0x11){
datai=fgetc(fp1);
if(datai<10) fprintf(fp2," %d / ",datai);
else if(datai<100) fprintf(fp2," %d / ",datai);
else fprintf(fp2,"%d / ",datai);
}
if(i == 0x12){
datai=fgetc(fp1);
if(datai<10) fprintf(fp2," %d ",datai);
else if(datai<100) fprintf(fp2," %d ",datai);
else fprintf(fp2,"%d ",datai);
}
if(i == 0x13){
datai=fgetc(fp1);
if(datai<10) fprintf(fp2," %d - ",datai);
else fprintf(fp2,"%d - ",datai);
}
if(i == 0x14){
datai=fgetc(fp1);
if(datai<10) fprintf(fp2," %d - ",datai);
else fprintf(fp2,"%d - ",datai);
}
if(i == 0x15){
datai=fgetc(fp1);
if(datai<10) fprintf(fp2," %d ",datai);
else fprintf(fp2,"%d ",datai);
}
if(i == 0x16){
datai=fgetc(fp1);
if(datai<10) fprintf(fp2," %d\n",datai);
else if(datai==100) fprintf(fp2,"%d\n",datai);
else fprintf(fp2," %d\n",datai);
}
}
for(i = 0;i < 9;i++) datai=fgetc(fp1);
}
printf("投手終了/");
fprintf(fp2,"\n監 ");
for(i = 0;i < 0x17;i++){
if((i >= 0)&&(i < 5)){
datai=fgetc(fp1);
d = namebt(datai);
sa = d / 0x100;sb = d % 0x100;
fprintf(fp2,"%c%c",sa,sb);
}
if(i == 5) datai=fgetc(fp1);
if(i == 6){
datai=fgetc(fp1);
if(datai) fprintf(fp2," やせ\n\n");
else fprintf(fp2," でぶ\n\n");
}
}
for(i = 0;i < 25;i++) datai=fgetc(fp1);
printf("終了\n");
}
fclose(fp1);
fclose(fp2);
}
int namebt(int data){
int d;
switch(data%0x100){
case 0x18:d=0x8283;break;
case 0x19:d=0x90e6;break;
case 0x20:d=0x8140;break;
case 0x21:d=0x8149;break;
case 0x22:d=0x8168;break;
case 0x23:d=0x8194;break;
case 0x24:d=0x8190;break;
case 0x25:d=0x8193;break;
case 0x26:d=0x8195;break;
case 0x27:d=0x8166;break;
case 0x2a:d=0x8196;break;
case 0x2b:d=0x817b;break;
case 0x2c:d=0x8165;break;
case 0x2d:d=0x817c;break;
case 0x2e:d=0x8145;break;
case 0x2f:d=0x815e;break;
case 0x30:d=0x814f;break;
case 0x31:d=0x8150;break;
case 0x32:d=0x8151;break;
case 0x33:d=0x8152;break;
case 0x34:d=0x8153;break;
case 0x35:d=0x8154;break;
case 0x36:d=0x8155;break;
case 0x37:d=0x8156;break;
case 0x38:d=0x8157;break;
case 0x39:d=0x8158;break;
case 0x3a:d=0x8146;break;
case 0x3b:d=0x8147;break;
case 0x3c:d=0x8183;break;
case 0x3d:d=0x8181;break;
case 0x3e:d=0x8184;break;
case 0x3f:d=0x8148;break;
case 0x40:d=0x8197;break;
case 0x41:d=0x8260;break;
case 0x42:d=0x8261;break;
case 0x43:d=0x8262;break;
case 0x44:d=0x8263;break;
case 0x45:d=0x8264;break;
case 0x46:d=0x8265;break;
case 0x47:d=0x8266;break;
case 0x48:d=0x8267;break;
case 0x49:d=0x8268;break;
case 0x4a:d=0x8269;break;
case 0x4b:d=0x826a;break;
case 0x4c:d=0x826b;break;
case 0x4d:d=0x826c;break;
case 0x4e:d=0x826d;break;
case 0x4f:d=0x826e;break;
case 0x50:d=0x826f;break;
case 0x51:d=0x8270;break;
case 0x52:d=0x8271;break;
case 0x53:d=0x8272;break;
case 0x54:d=0x8273;break;
case 0x55:d=0x8274;break;
case 0x56:d=0x8275;break;
case 0x57:d=0x8276;break;
case 0x58:d=0x8277;break;
case 0x59:d=0x8278;break;
case 0x5a:d=0x8279;break;
case 0x80:d=0x82a0;break;
case 0x81:d=0x82a2;break;
case 0x82:d=0x82a4;break;
case 0x83:d=0x82a6;break;
case 0x84:d=0x82a8;break;
case 0x85:d=0x82a9;break;
case 0x86:d=0x82ab;break;
case 0x87:d=0x82ad;break;
case 0x88:d=0x82af;break;
case 0x89:d=0x82b1;break;
case 0x8a:d=0x82b3;break;
case 0x8b:d=0x82b5;break;
case 0x8c:d=0x82b7;break;
case 0x8d:d=0x82b9;break;
case 0x8e:d=0x82bb;break;
case 0x8f:d=0x82bd;break;
case 0x90:d=0x82bf;break;
case 0x91:d=0x82c2;break;
case 0x92:d=0x82c4;break;
case 0x93:d=0x82c6;break;
case 0x94:d=0x82c8;break;
case 0x95:d=0x82c9;break;
case 0x96:d=0x82ca;break;
case 0x97:d=0x82cb;break;
case 0x98:d=0x82cc;break;
case 0x99:d=0x82cd;break;
case 0x9a:d=0x82d0;break;
case 0x9b:d=0x82d3;break;
case 0x9c:d=0x82d6;break;
case 0x9d:d=0x82d9;break;
case 0x9e:d=0x82dc;break;
case 0x9f:d=0x82dd;break;
case 0xa0:d=0x82de;break;
case 0xa1:d=0x82df;break;
case 0xa2:d=0x82e0;break;
case 0xa3:d=0x82e2;break;
case 0xa4:d=0x82e4;break;
case 0xa5:d=0x82e6;break;
case 0xa6:d=0x82e7;break;
case 0xa7:d=0x82e8;break;
case 0xa8:d=0x82e9;break;
case 0xa9:d=0x82ea;break;
case 0xaa:d=0x82eb;break;
case 0xab:d=0x82ed;break;
case 0xac:d=0x82f0;break;
case 0xad:d=0x82f1;break;
case 0xae:d=0x82c1;break;
case 0xaf:d=0x82e1;break;
case 0xb0:d=0x82e3;break;
case 0xb1:d=0x82e5;break;
case 0xb2:d=0x814a;break;
case 0xb3:d=0x814b;break;
case 0xb4:d=0x8341;break;
case 0xb5:d=0x8343;break;
case 0xb6:d=0x8345;break;
case 0xb7:d=0x8347;break;
case 0xb8:d=0x8349;break;
case 0xb9:d=0x834a;break;
case 0xba:d=0x834c;break;
case 0xbb:d=0x834e;break;
case 0xbc:d=0x8350;break;
case 0xbd:d=0x8352;break;
case 0xbe:d=0x8354;break;
case 0xbf:d=0x8356;break;
case 0xc0:d=0x8358;break;
case 0xc1:d=0x835a;break;
case 0xc2:d=0x835c;break;
case 0xc3:d=0x835e;break;
case 0xc4:d=0x8360;break;
case 0xc5:d=0x8363;break;
case 0xc6:d=0x8365;break;
case 0xc7:d=0x8367;break;
case 0xc8:d=0x8369;break;
case 0xc9:d=0x836a;break;
case 0xca:d=0x836b;break;
case 0xcb:d=0x836c;break;
case 0xcc:d=0x836d;break;
case 0xcd:d=0x836e;break;
case 0xce:d=0x8371;break;
case 0xcf:d=0x8374;break;
case 0xd0:d=0x8377;break;
case 0xd1:d=0x837a;break;
case 0xd2:d=0x837d;break;
case 0xd3:d=0x837e;break;
case 0xd4:d=0x8380;break;
case 0xd5:d=0x8381;break;
case 0xd6:d=0x8382;break;
case 0xd7:d=0x8384;break;
case 0xd8:d=0x8386;break;
case 0xd9:d=0x8388;break;
case 0xda:d=0x8389;break;
case 0xdb:d=0x838a;break;
case 0xdc:d=0x838b;break;
case 0xdd:d=0x838c;break;
case 0xde:d=0x838d;break;
case 0xdf:d=0x838f;break;
case 0xe0:d=0x8392;break;
case 0xe1:d=0x8393;break;
case 0xe2:d=0x8362;break;
case 0xe3:d=0x8383;break;
case 0xe4:d=0x8385;break;
case 0xe5:d=0x8387;break;
case 0xe6:d=0x8340;break;
case 0xe7:d=0x8342;break;
case 0xe8:d=0x8344;break;
case 0xe9:d=0x8346;break;
case 0xea:d=0x8348;break;
case 0xeb:d=0x815b;break;
case 0xec:d=0x89f1;break;
case 0xed:d=0x967b;break;
case 0xee:d=0x9668;break;
case 0xef:d=0x8945;break;
case 0xfc:d=0x8db6;break;
case 0xfd:d=0x8141;break;
case 0xfe:d=0x8142;break;
case 0xff:d=0x81a1;break;
default:d=0x8140;break;
}
return d;
}